<?php

namespace App\Events\Kms;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class PunchShareEvent
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * 分享类型
     *
     * @var array
     */
    public array $punchType;

    /**
     * 备注
     *
     * @var string
     */
    public string $remark;

    /**
     * 资源id
     *
     * @var int
     */
    public int $resourceId;

    /**
     * 群id
     *
     * @var array
     */
    public array $groupIds;

    public array $shareUser;


    /**
     * @param array $punchType
     * @param string $remark
     * @param int $resourceId
     * @param array $groupIds
     * @param array $shareUser
     */
    public function __construct(array $punchType, string $remark, int $resourceId, array $groupIds, array $shareUser)
    {
        $this->groupIds   = $groupIds;
        $this->remark     = $remark;
        $this->resourceId = $resourceId;
        $this->punchType  = $punchType;
        $this->shareUser  = $shareUser;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
